/************************************************************************************
Copyright (c) 2019, Chongqing Unisinsight Technologies Co., Ltd. All rights reserved.
-------------------------------------------------------------------------------------
FilePath     : \src\hzmm_nwm.cpp
Author       : tanrui<tan.rui@unisinsight.com>
Date         : 2021-11-03 20:06:34
LastEditors  : OBKora1
LastEditTime : 2021-11-05 17:43:16
Description  : 

-------------------------------------------------------------------------------------
Modification History
DATE            NAME             DESCRIPTION
-------------------------------------------------------------------------------------

************************************************************************************/
#include "mmd/hzmm_nwm.h"

extern "C" {
#include <malloc.h>
extern void *__libc_malloc(size_t size);
static void *(*real_malloc)(size_t size) = __libc_malloc;
}

void *operator new(size_t size)
{
    void *caller = __builtin_return_address(0);
    void *ptr = NULL;
    ptr = real_malloc(size);
    record_mem_change(OP_MLL, caller, ptr, size);
    return ptr;
}
void  operator delete(void *ptr)
{
    free(ptr);
}

void init_nwm_caller()
{
    int *ptr = new(int);
    delete(ptr);
}
